<!Doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>Java 格式化输出 printf 用法 | 菜鸟教程</title>

  <meta name='robots' content='max-image-preview:large' />
<link rel='stylesheet' id='classic-theme-styles-css' href='../0/classic-themes.min.css?ver=6.2' type='text/css' media='all' />
<link rel="canonical" href="../w3cnote/java-printf-formate-demo.html" />
<meta name="keywords" content="Java 格式化输出 printf 用法">
<meta name="description" content="Java 中的 printf 方法用于格式化输出。 格式化指定了输出的形式，包括数字的精度、字符宽度、日期格式等等。下面是一些常用的格式化符号和用法：  字符串格式化  %s : 输出字符串     实例 [mycode4 type=&#039;java&#039;] System.out.printf(&#039;%s&#039;, &#039;hello world&#039;); // 输出 &#039;hello world&#..">
		
	<link rel="shortcut icon" href="https://static.runoob.com/images/favicon.ico">
	<link rel="stylesheet" href="../0/style.css?v=1.170" type="text/css" media="all" />	
	<link rel="stylesheet" href="../0/font-awesome.min.css" media="all" />	
  <!--[if gte IE 9]><!-->
  <script src=""></script>
  <!--<![endif]-->
  <!--[if lt IE 9]>
     <script src=""></script>
     <script src=""></script>
  <![endif]-->
  <link rel="apple-touch-icon" href="https://static.runoob.com/images/icon/mobile-icon.png"/>
  <meta name="apple-mobile-web-app-title" content="菜鸟教程">
</head>
<body>

<!--  头部 -->
<div class="container logo-search">

  <div class="col search row-search-mobile">
    <form action="index.php">
      <input class="placeholder" placeholder="搜索……" name="s" autocomplete="off">
      
    </form>
  </div>

  <div class="row">
    <div class="col logo">
      <h1><a href="../">菜鸟教程 -- 学的不仅是技术，更是梦想！</a></h1>
    </div>
        <div class="col right-list"> 
    <button class="btn btn-responsive-nav btn-inverse" data-toggle="collapse" data-target=".nav-main-collapse" id="pull" style=""> <i class="fa fa-navicon"></i> </button>
    </div>
        
    <div class="col search search-desktop last">
      <div class="search-input" >
      <form action="//www.runoob.com/" target="_blank">
        <input class="placeholder" id="s" name="s" placeholder="搜索……"  autocomplete="off" style="height: 44px;">
      </form>
      
      </div>
    </div>
  </div>
</div>



<!-- 导航栏 -->
<div class="container navigation">
    <div class="row">
        <div class="col nav">
            

                        <ul class="pc-nav" id="note-nav">
                <li><a href="../">首页</a></li>
                <li><a href="../w3cnote">笔记首页</a></li>
                <li><a href="../w3cnote/android-tutorial-intro.html" title="Android 基础入门教程">Android</a></li>
                <li><a href="../w3cnote/es6-tutorial.html" title="ES6 教程">ES6 教程</a></li>
                <li><a href="../w3cnote/ten-sorting-algorithm.html" title="排序算法">排序算法</a></li>
                <li><a href="../w3cnote/hadoop-tutorial.html" title="Hadoop 教程">Hadoop</a></li>
                <li><a href="../w3cnote/zookeeper-tutorial.html" title="Zookeeper 教程">Zookeeper</a></li>
                <li><a href="../w3cnote/verilog-tutorial.html" title="Verilog 教程">Verilog</a></li>
                <li><a href="../w3cnote_genre/code" title="编程技术">编程技术</a></li> 
                <li><a href="../w3cnote_genre/coderlife" title="程序员人生">程序员人生</a></li>
                
                <!--<li><a href="javascript:;" class="runoob-pop">登录</a></li>
                
                
                        <li>
                <a style="font-weight:bold;" href="../linux/linux-tutorial.html#yunserver" target="_blank" onclick="_hmt.push(['_trackEvent', 'aliyun', 'click', 'aliyun'])" title="kkb">云服务器</a>
                </li>
                <li><a href="http://gk.link/a/104mQ" target="_blank" style="font-weight: bold;"onclick="_hmt.push(['_trackEvent', '极客时间', 'click', 'jike'])" title="我的圈子">极客时间</a></li>
            
                
                <li><a target="_blank" href="../shoppinglist" rel="nofollow">知识店铺</a></li> 
        -->
            </ul>
                        
              
            <ul class="mobile-nav">
                <li><a href="../w3cnote">首页</a></li>
                <li><a href="../w3cnote_genre/android" target="_blank" title="Android 基础入门教程">Android</a></li>
                <li><a href="../w3cnote/es6-tutorial.html" target="_blank" title="ES6 教程">ES6</a></li>
                <li><a href="../w3cnote_genre/joke" target="_blank" title="程序员笑话">逗乐</a></li>
                
                <a href="javascript:void(0)" class="search-reveal">Search</a> 
            </ul>
            
        </div>
    </div>
</div>


<!--  内容  -->
<div class="container main">
	<div class="row">

		<div class="col middle-column big-middle-column">
	 			<div class="article">
			<div class="article-heading">
				<h2>Java 格式化输出 printf 用法</h2>				<h3><em>分类</em> <a href="../w3cnote_genre/code" title="编程技术" >编程技术</a> </h3>
			</div>
			<div class="article-body note-body">
				<div class="article-intro">
					<p>Java 中的 printf 方法用于格式化输出。</p><p>
格式化指定了输出的形式，包括数字的精度、字符宽度、日期格式等等。下面是一些常用的格式化符号和用法：</p>

<p><strong>字符串格式化</strong></p>
<ul>
<li>%s : 输出字符串</li></ul>




<div class="example"><h2 class="example">实例</h2> <div class="example_code">
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%s&quot;</span>, <span style="color: #0000ff;">&quot;hello world&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 输出 &quot;hello world&quot;</span><br />
</div></div>

<p><strong>整数格式化</strong></p><ul>
<li>
%d : 输出十进制整数
</li><li>
%o : 输出八进制整数
</li><li>
%x : 输出十六进制整数
</li><li>
%X : 输出大写十六进制整数
</li></ul>
<div class="example"><h2 class="example">实例</h2> <div class="example_code">
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%d %o %x %X&quot;</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 输出 &quot;10 12 a A&quot;</span><br />
</div></div>

<p><strong>浮点数格式化</strong></p><ul>
<li>
%f : 输出浮点数
</li><li>
%e : 输出科学计数法表示的浮点数（小写e）
</li><li>
%E : 输出科学计数法表示的浮点数（大写E）
</li><li>
%.nf : 控制小数点后的位数，n为数字
</li></ul>
<div class="example"><h2 class="example">实例</h2> <div class="example_code">
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%.2f %e %E&quot;</span>, <span style="color: #cc66cc;">3.1415926</span>, <span style="color: #cc66cc;">3.1415926</span>, <span style="color: #cc66cc;">3.1415926</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 输出 &quot;3.14 3.141593e+00 3.141593E+00&quot;</span><br />
</div></div>

<p><strong>布尔值格式化</strong></p>
<ul>
<li>%b : 输出布尔值</li></ul>




<div class="example"><h2 class="example">实例</h2> <div class="example_code">
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%b&quot;</span>, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 输出 &quot;true&quot;</span><br />
</div></div>

<p><strong>字符格式化</strong></p>
<ul>
<li>%c : 输出字符</li></ul>




<div class="example"><h2 class="example">实例</h2> <div class="example_code">
System.out.printf<span style="color: #9F79EE;">&#40;</span><span style="color: #FF00FF;">&quot;%c&quot;</span><span style="color: #5D478B;">,</span> 'a'<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">;</span> <span style="color: #00008B; font-style: italic;">// 输出 &quot;a&quot;</span><br />
</div></div>

<p><strong>宽度和精度格式化</strong></p><ul>
<li>
%n$ : 指定第n个参数
</li><li>
%m.n : 控制宽度和精度，m表示最小宽度，n表示小数点后的位数
</li></ul>
<div class="example"><h2 class="example">实例</h2> <div class="example_code">
System.out.printf<span style="color: #9F79EE;">&#40;</span><span style="color: #FF00FF;">&quot;%2d %5.2f %s&quot;</span><span style="color: #5D478B;">,</span> <span style="color: #ff0055;">10</span><span style="color: #5D478B;">,</span> <span style="color: #ff0055;">3.1415926</span><span style="color: #5D478B;">,</span> <span style="color: #FF00FF;">&quot;hello&quot;</span><span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">;</span> <span style="color: #00008B; font-style: italic;">// 输出 &quot;10 3.14 hello&quot;</span><br />
</div></div>
<p>

下面是 Java 中 printf 方法中可用的完整格式符号列表：</p>
<ul><li>%d：带符号的十进制整数</li><li>%o：不带符号的八进制整数</li><li>%x、%X：不带符号的十六进制整数，分别使用小写字母和大写字母表示</li><li>%f、%F：带小数点的十进制浮点数，分别使用小写字母和大写字母表示</li><li>%e、%E：带指数的浮点数，分别使用小写字母和大写字母表示</li><li>%g、%G：根据数值大小自动选择%f或%e格式，分别使用小写字母和大写字母表示</li><li>%a、%A：十六进制浮点数，分别使用小写字母和大写字母表示</li><li>%c：字符类型，输出单个字符</li><li>%s：字符串类型，输出字符串</li><li>%n：换行符</li><li>%%：输出一个百分号%</li><li>%h、%H：散列码，分别使用十六进制和十六进制大写字母表示</li><li>%t、%T：日期和时间格式化，使用特定的转换字符表示，例如%tY表示年份，%tB表示月份全称</li><li>%b、%B：布尔值类型，输出true或false，分别使用小写字母和大写字母表示</li><li>%S：输出大写字母的字符串</li></ul>

<p>下面是 Java 中 printf 方法中可用于格式化日期的符号列表：</p>
<ul><li>%tB：本地化的月份全名</li><li>%tb：本地化的月份缩写</li><li>%tA：本地化的星期全名</li><li>%ta：本地化的星期缩写</li><li>%tY：四位数的年份</li><li>%ty：两位数的年份</li><li>%tm：两位数的月份</li><li>%td：两位数的日期</li><li>%te：一位或两位数的日期</li><li>%tH：24小时制的小时数</li><li>%tI：12小时制的小时数</li><li>%tM：分钟数</li><li>%tS：秒数</li><li>%tp：上午或下午</li><li>%tZ：时区</li></ul>
<div class="example"> 
<h2 class="example">实例</h2> 
<div class="example_code">
<div class="hl-main"><span class="hl-reserved">import</span><span class="hl-code"> </span><span class="hl-identifier">java</span><span class="hl-code">.</span><span class="hl-identifier">util</span><span class="hl-code">.</span><span class="hl-identifier">Date</span><span class="hl-code">;
 
</span><span class="hl-comment">/*</span><span class="hl-comment">*
 * 使用printf输出
 </span><span class="hl-comment">*/</span><span class="hl-code">
</span><span class="hl-comment">/*</span><span class="hl-comment">*关键技术点
 * 使用java.io.PrintStream的printf方法实现C风格的输出
 * printf 方法的第一个参数为输出的格式,第二个参数是可变长的,表示待输出的数据对象
 </span><span class="hl-comment">*/</span><span class="hl-code">
</span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-reserved">class</span><span class="hl-code"> </span><span class="hl-identifier">Printf</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
 
       </span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-types">void</span><span class="hl-code"> </span><span class="hl-identifier">main</span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-brackets">[</span><span class="hl-brackets">]</span><span class="hl-code"> </span><span class="hl-identifier">args</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
              </span><span class="hl-comment">/*</span><span class="hl-comment">** 输出字符串 **</span><span class="hl-comment">*/</span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %s表示输出字符串，也就是将后面的字符串替换模式中的%s</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%s</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">Integer</span><span class="hl-brackets">(</span><span class="hl-number">1212</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %n表示换行</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%s%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">end line</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> 还可以支持多个参数</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%s = %s%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">Name</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">Zhangsan</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %S将字符串以大写形式输出</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%S = %s%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">Name</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">Zhangsan</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> 支持多个参数时，可以在%s之间插入变量编号，1$表示第一个字符串，3$表示第3个字符串</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$s = %3$s %2$s%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">Name</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">san</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">Zhang</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">/*</span><span class="hl-comment">** 输出boolean类型 **</span><span class="hl-comment">*/</span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">true = %b; false = </span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">true</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%b%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-reserved">false</span><span class="hl-brackets">)</span><span class="hl-code">;
 
              </span><span class="hl-comment">/*</span><span class="hl-comment">** 输出整数类型**</span><span class="hl-comment">*/</span><span class="hl-code">
              </span><span class="hl-identifier">Integer</span><span class="hl-code"> </span><span class="hl-identifier">iObj</span><span class="hl-code"> = </span><span class="hl-number">342</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %d表示将整数格式化为10进制整数</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%d; %d; %d%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">500</span><span class="hl-code">, </span><span class="hl-number">2343</span><span class="hl-identifier">L</span><span class="hl-code">, </span><span class="hl-identifier">iObj</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %o表示将整数格式化为8进制整数</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%o; %o; %o%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">500</span><span class="hl-code">, </span><span class="hl-number">2343</span><span class="hl-identifier">L</span><span class="hl-code">, </span><span class="hl-identifier">iObj</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %x表示将整数格式化为16进制整数</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%x; %x; %x%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">500</span><span class="hl-code">, </span><span class="hl-number">2343</span><span class="hl-identifier">L</span><span class="hl-code">, </span><span class="hl-identifier">iObj</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %X表示将整数格式化为16进制整数，并且字母变成大写形式</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%X; %X; %X%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">500</span><span class="hl-code">, </span><span class="hl-number">2343</span><span class="hl-identifier">L</span><span class="hl-code">, </span><span class="hl-identifier">iObj</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">/*</span><span class="hl-comment">** 输出浮点类型**</span><span class="hl-comment">*/</span><span class="hl-code">
              </span><span class="hl-identifier">Double</span><span class="hl-code"> </span><span class="hl-identifier">dObj</span><span class="hl-code"> = </span><span class="hl-number">45</span><span class="hl-number">.6</span><span class="hl-identifier">d</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %e表示以科学技术法输出浮点数</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%e; %e; %e%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">756</span><span class="hl-number">.403</span><span class="hl-identifier">f</span><span class="hl-code">, </span><span class="hl-number">7464</span><span class="hl-number">.232641</span><span class="hl-identifier">d</span><span class="hl-code">, </span><span class="hl-identifier">dObj</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %E表示以科学技术法输出浮点数，并且为大写形式            </span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%E; %E; %E%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">756</span><span class="hl-number">.403</span><span class="hl-identifier">f</span><span class="hl-code">, </span><span class="hl-number">7464</span><span class="hl-number">.232641</span><span class="hl-identifier">d</span><span class="hl-code">, </span><span class="hl-identifier">dObj</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %f表示以十进制格式化输出浮点数</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%f; %f; %f%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">756</span><span class="hl-number">.403</span><span class="hl-identifier">f</span><span class="hl-code">, </span><span class="hl-number">7464</span><span class="hl-number">.232641</span><span class="hl-identifier">d</span><span class="hl-code">, </span><span class="hl-identifier">dObj</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> 还可以限制小数点后的位数</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%.1f; %.3f; %f%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, -</span><span class="hl-number">756</span><span class="hl-number">.403</span><span class="hl-identifier">f</span><span class="hl-code">, </span><span class="hl-number">7464</span><span class="hl-number">.232641</span><span class="hl-identifier">d</span><span class="hl-code">, </span><span class="hl-identifier">dObj</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">/*</span><span class="hl-comment">** 输出日期类型**</span><span class="hl-comment">*/</span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t表示格式化日期时间类型，%T是时间日期的大写形式，在%t之后用特定的字母表示不同的输出格式</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">Date</span><span class="hl-code"> </span><span class="hl-identifier">date</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">Date</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-types">long</span><span class="hl-code"> </span><span class="hl-identifier">dataL</span><span class="hl-code"> = </span><span class="hl-identifier">date</span><span class="hl-code">.</span><span class="hl-identifier">getTime</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> 格式化年月日</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用y表示输出日期的年份（2位数的年，如99）</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用m表示输出日期的月份，%t之后用d表示输出日期的日号</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$ty-%1$tm-%1$td; %2$ty-%2$tm-%2$td%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-code">, </span><span class="hl-identifier">dataL</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用Y表示输出日期的年份（4位数的年），</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用B表示输出日期的月份的完整名， %t之后用b表示输出日期的月份的简称</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tY-%1$tB-%1$td; %2$tY-%2$tb-%2$td%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-code">, </span><span class="hl-identifier">dataL</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">//</span><span class="hl-comment"> 以下是常见的日期组合</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用D表示以 &quot;%tm/%td/%ty&quot;格式化日期</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tD%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment">%t之后用F表示以&quot;%tY-%tm-%td&quot;格式化日期</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tF%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">/*</span><span class="hl-comment">** 输出时间类型**</span><span class="hl-comment">*/</span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> 输出时分秒</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用H表示输出时间的时（24进制），%t之后用I表示输出时间的时（12进制），</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用M表示输出时间的分，%t之后用S表示输出时间的秒</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tH:%1$tM:%1$tS; %2$tI:%2$tM:%2$tS%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-code">, </span><span class="hl-identifier">dataL</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用L表示输出时间的秒中的毫秒</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tH:%1$tM:%1$tS %1$tL%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后p表示输出时间的上午或下午信息</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tH:%1$tM:%1$tS %1$tL %1$tp%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">//</span><span class="hl-comment"> 以下是常见的时间组合</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用R表示以&quot;%tH:%tM&quot;格式化时间</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tR%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用T表示以&quot;%tH:%tM:%tS&quot;格式化时间</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tT%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用r表示以&quot;%tI:%tM:%tS %Tp&quot;格式化时间</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tr%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">/*</span><span class="hl-comment">** 输出星期**</span><span class="hl-comment">*/</span><span class="hl-code">
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用A表示得到星期几的全称</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tF %1$tA%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
              </span><span class="hl-comment">//</span><span class="hl-comment"> %t之后用a表示得到星期几的简称</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tF %1$ta%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
             
              </span><span class="hl-comment">//</span><span class="hl-comment"> 输出时间日期的完整信息</span><span class="hl-comment"></span><span class="hl-code">
              </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">printf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%1$tc%n</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-identifier">date</span><span class="hl-brackets">)</span><span class="hl-code">;
       </span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-comment">/*</span><span class="hl-comment">*
 *printf方法中,格式为&quot;%s&quot;表示以字符串的形式输出第二个可变长参数的第一个参数值;
 *格式为&quot;%n&quot;表示换行;格式为&quot;%S&quot;表示将字符串以大写形式输出;在&quot;%s&quot;之间用&quot;n$&quot;表示
 *输出可变长参数的第n个参数值.格式为&quot;%b&quot;表示以布尔值的形式输出第二个可变长参数
 *的第一个参数值.
 </span><span class="hl-comment">*/</span><span class="hl-code">
</span><span class="hl-comment">/*</span><span class="hl-comment">*
 * 格式为&quot;%d&quot;表示以十进制整数形式输出;&quot;%o&quot;表示以八进制形式输出;&quot;%x&quot;表示以十六进制
 * 输出;&quot;%X&quot;表示以十六进制输出,并且将字母(A、B、C、D、E、F)换成大写.格式为&quot;%e&quot;表
 * 以科学计数法输出浮点数;格式为&quot;%E&quot;表示以科学计数法输出浮点数,而且将e大写;格式为
 * &quot;%f&quot;表示以十进制浮点数输出,在&quot;%f&quot;之间加上&quot;.n&quot;表示输出时保留小数点后面n位.
 </span><span class="hl-comment">*/</span><span class="hl-code">
</span><span class="hl-comment">/*</span><span class="hl-comment">*
 * 格式为&quot;%t&quot;表示输出时间日期类型.&quot;%t&quot;之后用y表示输出日期的二位数的年份(如99)、用m
 * 表示输出日期的月份,用d表示输出日期的日号;&quot;%t&quot;之后用Y表示输出日期的四位数的年份
 * (如1999)、用B表示输出日期的月份的完整名,用b表示输出日期的月份的简称.&quot;%t&quot;之后用D
 * 表示以&quot;%tm/%td/%ty&quot;的格式输出日期、用F表示以&quot;%tY-%tm-%td&quot;的格式输出日期.
 </span><span class="hl-comment">*/</span><span class="hl-code">
</span><span class="hl-comment">/*</span><span class="hl-comment">*
 * &quot;%t&quot;之后用H表示输出时间的时(24进制),用I表示输出时间的时(12进制),用M表示输出时间
 * 分,用S表示输出时间的秒,用L表示输出时间的秒中的毫秒数、用 p 表示输出时间的是上午还是
 * 下午.&quot;%t&quot;之后用R表示以&quot;%tH:%tM&quot;的格式输出时间、用T表示以&quot;%tH:%tM:%tS&quot;的格式输出
 * 时间、用r表示以&quot;%tI:%tM:%tS %Tp&quot;的格式输出时间.
 </span><span class="hl-comment">*/</span><span class="hl-code">
</span><span class="hl-comment">/*</span><span class="hl-comment">*
 * &quot;%t&quot;之后用A表示输出日期的全称,用a表示输出日期的星期简称.
 </span><span class="hl-comment">*/</span></div>
</div>

</div>				</div>
			</div>
			<div class="previous-next-links">
			<div class="previous-design-link">← <a href="../w3cnote/java-print-the-triangle.html" rel="prev"> JAVA 打印三角形</a> </div>
			<div class="next-design-link"><a href="../w3cnote/https-ssl-intro.html" rel="next"> HTTPS 与 SSL 证书概要</a> →</div>
			</div>
						<div class="article-heading-ad" id="w3cnote-ad728">
			<script async src=""></script>
			<!-- 移动版 自动调整 -->
			<ins class="adsbygoogle"
			     style="display:inline-block;min-width:300px;max-width:970px;width:100%;height:90px"
			     data-ad-client="ca-pub-5751451760833794"
			     data-ad-slot="1691338467"
			     data-ad-format="horizontal"></ins>
			<script>
			(adsbygoogle = window.adsbygoogle || []).push({});
			</script>
			</div>
			<style>
@media screen and (max-width: 768px) {
	#w3cnote-ad728 {
		display: none;
	}
}
p.note-author {
    border-bottom: 1px solid #ddd;
    font-size: 18px;
    font-weight: bold;
    color: #78a15a;
    padding-bottom: 2px;
    margin-bottom: 4px;
}
</style>
<script>
var aid = 18787;
</script>
	</div>
		
	</div>
	<div class="listcol last right-column">




<!--
	<div class="tab tab-light-blue"> 订阅</div>
	<div class="sidebar-box">
		<div class="socialicons">
			<a href="../feed" class="rss">RSS 订阅</a>
		
			<form action="//list.qq.com/cgi-bin/qf_compose_send" method="post">
			<input type="hidden" value="qf_booked_feedback" name="t">
			<input type="hidden" value="4b67b6b6c1f5e792559940cab4aebb8f1126fba880bff1a8" name="id">
			<input class="placeholder" id="feed_email" name="to" value="输入邮箱 订阅笔记" autocomplete="off">
			<input type="submit" value="订阅" class="btn btn-primary">
			</form>
		
		</div>
 
	</div>
-->	



<!--
	<div class="sidebar-box cate-list">
	<div class="sidebar-box recommend-here list-link">
			<a href="javascript:void(0);" style="font-size: 16px; color:#64854c;font-weight:bold;">笔记列表</a>
		</div>

 

</div>
-->

	 <div class="sidebar-box cate-list">
		 		

	 	<div class="sidebar-box recommend-here list-link">
			<a href="javascript:void(0);" style="font-size: 16px; color:#64854c;font-weight:bold;">教程列表</a>
		</div>
		
		<div class="cate-items"> 
				<a href="../ado">ADO 教程</a>
	<a href="../ajax">Ajax 教程</a>
	<a href="../android">Android 教程</a>
	<a href="../angularjs2">Angular2 教程</a>
	<a href="../angularjs">AngularJS 教程</a>
	<a href="../appml">AppML 教程</a>
	<a href="../asp">ASP 教程</a>
	<a href="../aspnet">ASP.NET 教程</a>
	<a href="../bootstrap">Bootstrap 教程</a>
	<a href="../bootstrap4">Bootstrap4 教程</a>
	<a href="../bootstrap5">Bootstrap5 教程</a>
	<a href="../cprogramming">C 教程</a>
	<a href="../csharp">C# 教程</a>
	<a href="../cplusplus">C++ 教程</a>
	<a href="../chartjs">Chart.js 教程</a>
	<a href="../cssref">CSS 参考手册</a>
	<a href="../css">CSS 教程</a>
	<a href="../css3">CSS3 教程</a>
	<a href="../django">Django 教程</a>
	<a href="../docker">Docker 教程</a>
	<a href="../dtd">DTD 教程</a>
	<a href="../echarts">ECharts 教程</a>
	<a href="../eclipse">Eclipse 教程</a>
	<a href="../firebug">Firebug 教程</a>
	<a href="../font-awesome">Font Awesome 图标</a>
	<a href="../foundation">Foundation 教程</a>
	<a href="../git">Git 教程</a>
	<a href="../go">Go 语言教程</a>
	<a href="../googleapi">Google 地图 API 教程</a>
	<a href="../highcharts">Highcharts 教程</a>
	<a href="../htmldom">HTML DOM 教程</a>
	<a href="../tags">HTML 参考手册</a>
	<a href="../charsets">HTML 字符集</a>
	<a href="../html">HTML 教程</a>
	<a href="../http">HTTP 教程</a>
	<a href="../ionic">ionic 教程</a>
	<a href="../ios">iOS 教程</a>
	<a href="../java">Java 教程</a>
	<a href="../jsref">JavaScript 参考手册</a>
	<a href="../js">Javascript 教程</a>
	<a href="../jeasyui">jQuery EasyUI 教程</a>
	<a href="../jquerymobile">jQuery Mobile 教程</a>
	<a href="../jqueryui">jQuery UI 教程</a>
	<a href="../jquery">jQuery 教程</a>
	<a href="../json">JSON 教程</a>
	<a href="../jsp">JSP 教程</a>
	<a href="../julia">Julia 教程</a>
	<a href="../kotlin">Kotlin 教程</a>
	<a href="../linux">Linux 教程</a>
	<a href="../lua">Lua 教程</a>
	<a href="../markdown">Markdown 教程</a>
	<a href="../matplotlib">Matplotlib 教程</a>
	<a href="../maven">Maven 教程</a>
	<a href="../memcached">Memcached 教程</a>
	<a href="../mongodb">MongoDB 教程</a>
	<a href="../mysql">MySQL 教程</a>
	<a href="../nodejs">Node.js 教程</a>
	<a href="../numpy">NumPy 教程</a>
	<a href="../pandas">Pandas 教程</a>
	<a href="../perl">Perl 教程</a>
	<a href="../php">PHP 教程</a>
	<a href="../postgresql">PostgreSQL 教程</a>
	<a href="../python3">Python 3 教程</a>
	<a href="../python">Python 基础教程</a>
	<a href="../r">R 教程</a>
	<a href="../rdf">RDF 教程</a>
	<a href="../react">React 教程</a>
	<a href="../redis">Redis 教程</a>
	<a href="../rss">RSS 教程</a>
	<a href="../ruby">Ruby 教程</a>
	<a href="../rust">Rust 教程</a>
	<a href="../sass">Sass 教程</a>
	<a href="../scala">Scala 教程</a>
	<a href="../scipy">SciPy 教程</a>
	<a href="../servlet">Servlet 教程</a>
	<a href="../soap">SOAP 教程</a>
	<a href="../sql">SQL 教程</a>
	<a href="../sqlite">SQLite 教程</a>
	<a href="../svg">SVG 教程</a>
	<a href="../svn">SVN 教程</a>
	<a href="../swift">Swift 教程</a>
	<a href="../tcpip">TCP/IP 教程</a>
	<a href="../typescript">TypeScript 教程</a>
	<a href="../vbscript">VBScript 教程</a>
	<a href="../vue2">Vue.js 教程</a>
	<a href="../vue3">Vue3 教程</a>
	<a href="../w3c">W3C 教程</a>
	<a href="../webservices">Web Service 教程</a>
	<a href="../wsdl">WSDL 教程</a>
	<a href="../xlink">XLink 教程</a>
	<a href="../dom">XML DOM 教程</a>
	<a href="../schema">XML Schema 教程</a>
	<a href="../xml">XML 教程</a>
	<a href="../xpath">XPath 教程</a>
	<a href="../xquery">XQuery 教程</a>
	<a href="../xslfo">XSLFO 教程</a>
	<a href="../xsl">XSLT 教程</a>
	<a href="../data-structures">数据结构</a>
	<a href="../regexp">正则表达式</a>
	<a href="../quiz">测验</a>
	<a href="../browsers">浏览器</a>
	<a href="../quality">网站品质</a>
	<a href="../web">网站建设指南</a>
	<a href="../hosting">网站服务器教程</a>
	<a href="../design-pattern">设计模式</a>
			
		</div> 
		 	 </div>
</div>
	</div>
</div>


<!-- 底部 -->
<div id="footer" class="mar-t50">
   <div class="runoob-block">
    <div class="runoob cf">
     <dl>
      <dt>
       在线实例
      </dt>
      <dd>
       &middot;<a target="_blank" href="../html/html-examples.html">HTML 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../css/css-examples.html">CSS 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../js/js-examples.html">JavaScript 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../ajx/ajax-examples.html">Ajax 实例</a>
      </dd>
       <dd>
       &middot;<a target="_blank" href="../jquery/jquery-examples.html">jQuery 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../xml/xml-examples.html">XML 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../java/java-examples.html">Java 实例</a>
      </dd>
     
     </dl>
     <dl>
      <dt>
      字符集&工具
      </dt>
      <dd>
       &middot; <a target="_blank" href="../charsets/html-charsets.html">HTML 字符集设置</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="../tags/html-ascii.html">HTML ASCII 字符集</a>
      </dd>
     <dd>
       &middot; <a target="_blank" href="https://c.runoob.com/front-end/6939/">JS 混淆/加密</a>
      </dd> 
      <dd>
       &middot; <a target="_blank" href="https://c.runoob.com/front-end/6232/">PNG/JPEG 图片压缩</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="../tags/html-colorpicker.html">HTML 拾色器</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="..//c.runoob.com/front-end/53">JSON 格式化工具</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="..//c.runoob.com/front-end/6680/">随机数生成器</a>
      </dd>
     </dl>
     <dl>
      <dt>
       最新更新
      </dt>
                   <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imread.html" title="Matplotlib imread() 方法">Matplotlib imre...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imsave.html" title="Matplotlib imsave() 方法">Matplotlib imsa...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imshow.html" title="Matplotlib imshow() 方法">Matplotlib imsh...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-hist.html" title="Matplotlib 直方图">Matplotlib 直方图</a>
      </dd>
              <dd>
       &middot;
      <a href="../python3/python-func-object.html" title="Python object() 函数">Python object()...</a>
      </dd>
              <dd>
       &middot;
      <a href="../python3/python-ai-draw.html" title="Python AI 绘画">Python AI 绘画</a>
      </dd>
              <dd>
       &middot;
      <a href="../w3cnote/cursor-editor.html" title="神辅助 Cursor 编辑器，加入 GPT-4 让编码更轻松！">神辅助 Cursor ...</a>
      </dd>
             </dl>
     <dl>
      <dt>
       站点信息
      </dt>
      <dd>
       &middot;
       <a target="_blank" href="mailto:admin@runoob.com" rel="external nofollow">意见反馈</a>
       </dd>
      <dd>
       &middot;
      <a target="_blank" href="../disclaimer">免责声明</a>
       </dd>
      <dd>
       &middot;
       <a target="_blank" href="../aboutus">关于我们</a>
       </dd>
      <dd>
       &middot;
      <a target="_blank" href="../archives">文章归档</a>
      </dd>
    
     </dl>
    
     <div class="search-share">
      <div class="app-download">
        <div>
         <strong>关注微信</strong>
        </div>
      </div>
      <div class="share">
      <img width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png" />
       </div>
     </div>
     
    </div>
   </div>
   <div class="w-1000 copyright">
     Copyright &copy; 2013-2023    <strong><a href="../" target="_blank">菜鸟教程</a></strong>&nbsp;
    <strong><a href="../" target="_blank">runoob.com</a></strong> All Rights Reserved. 备案号：<a target="_blank" rel="nofollow" href="https://beian.miit.gov.cn/">闽ICP备15012807号-1</a>
   </div>
  </div>
  <div class="fixed-btn">
    <a class="go-top" href="javascript:void(0)" title="返回顶部"> <i class="fa fa-angle-up"></i></a>
    <a class="qrcode"  href="javascript:void(0)" title="关注我们"><i class="fa fa-qrcode"></i></a>
    <a class="writer" style="display:none" href="javascript:void(0)"   title="标记/收藏"><i class="fa fa-star" aria-hidden="true"></i></a>
    <!-- qrcode modal -->
    <div id="bottom-qrcode" class="modal panel-modal hide fade in">
      <h4>微信关注</h4>
      <div class="panel-body"><img alt="微信关注" width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png"></div> 
    </div>
  </div>

 <div style="display:none;">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-84264393-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-84264393-2');
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?3eec0b7da6548cf07db3bc477ea905ee";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</div>
<script>
window.jsui={
    www: 'https://www.runoob.com',
    uri: 'https://www.runoob.com/wp-content/themes/runoob'
};
</script>

<script src=""></script>
<script src=""></script>

</body>
</html>